from . import MainWindow
import os
# 功能Import
from ..CoreFromQQ import send_message

# flac 定义
flac = {
    'ComboBox(CtrlEnter)' : True
}

class Ui_MainWindow(MainWindow.Ui_MainWindow):
    def BindSingal(self):
        # StartButton
        self.StartButton.setShortcut('Ctrl+S')  
        self.StartButton.clicked.connect(self._commandStartBomb)

        self.SendModelComboBox.currentIndexChanged.connect(self._ExchangeSendModelFlac)
    
    def _commandStartBomb(self):
        message = self.MessageText.toPlainText()
        number = self.NumberText.toPlainText()
        os.popen('timeout /t 5').read()
        send_message(int(number), message, flac['ComboBox(CtrlEnter)'])
    def _ExchangeSendModelFlac(self, Model):
        global flac
        if Model == 'Ctrl + Enter':
            flac['ComboBox(CtrlEnter)'] = True
        else:
            flac['ComboBox(CtrlEnter)'] = False